home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
menubutn
/
menubutn.exe
/
Form1.frm
next >
Wrap
Text File
|
1997-07-09
|
3KB
|
104 lines
VERSION 5.00
Begin VB.Form Form1
Caption = "Menus With Radio Buttons"
ClientHeight = 2715
ClientLeft = 165
ClientTop = 735
ClientWidth = 5190
Icon = "Form1.frx":0000
LinkTopic = "Form1"
ScaleHeight = 2715
ScaleWidth = 5190
StartUpPosition = 3 'Windows Default
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "⌐ 1997 VB Center"
Height = 195
Left = 120
TabIndex = 1
Top = 2040
Width = 1305
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "VB Center Home: http://www.geocities.com/SiliconValley/Way/6445"
Height = 195
Left = 120
TabIndex = 0
Top = 2400
Width = 4920
End
Begin VB.Menu Options
Caption = "Options"
Begin VB.Menu mnuOptions
Caption = "Option Radio Item 1"
Index = 0
End
Begin VB.Menu mnuOptions
Caption = "Option Radio Item 2"
Index = 1
End
Begin VB.Menu mnuOptions
Caption = "Option Radio Item 3"
Index = 2
End
Begin VB.Menu mnuOptions
Caption = "-"
Index = 3
End
Begin VB.Menu mnuOptions
Caption = "Option Check Item 1"
Index = 4
End
Begin VB.Menu mnuOptions
Caption = "Option Check Item 2"
Index = 5
End
Begin VB.Menu mnuOptions
Caption = "Option Check Item 3"
Index = 6
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
' just change the radio check for the first 3 menu items
SetRadioMenuChecks mnuOptions(0), 0
SetRadioMenuChecks mnuOptions(1), 1
SetRadioMenuChecks mnuOptions(2), 2
End Sub
Private Sub SetRadioMenuChecks(Mnu As Menu, ByVal mnuItem&)
Dim hMenu&
Dim mInfo As MENUITEMINFO
' get the menu item handle
hMenu& = GetSubMenu(GetMenu(Mnu.Parent.hwnd), 0)
' copy it's attributes to the new Type,
' changing the checkmark to a radio button
mInfo.cbSize = Len(mInfo)
mInfo.fType = MFT_RADIOCHECK
mInfo.fMask = MIIM_TYPE
mInfo.dwTypeData = Mnu.Caption & Chr$(0)
' change the menu checkmark
SetMenuItemInfo hMenu&, mnuItem&, 1, mInfo
End Sub
Private Sub mnuOptions_Click(Index As Integer)
Static prevSelection As Integer
mnuOptions(prevSelection).Checked = False
mnuOptions(Index).Checked = True
prevSelection = Index
End Sub